package com.second.app.xml;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;

/**
 * @Author GYZ
 * @Date 2024/2/27
 * <pre>
 *
 * </pre>
 */
public class DocumentParser {

    public static Document getDocument(String xmlPath) throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
        return documentBuilder.parse(xmlPath);
    }
}
